import qs from 'qs'
import request from '../utils/request'

/**
 * 查询当前登录用户
 */
export const queryCurUser = () => {
  return request({
    method: 'GET',
    url: 'app/rest/account',
    noMessage: true
  })
}

/**
 * 登录接口
 */
export const login = (data) => {
  return request({
    method: 'POST',
    url: 'app/authentication',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    data: qs.stringify(data)
  })
}

/**
 * 退出接口
 */
export const logout = () => {
  return request({
    method: 'GET',
    url: 'app/logout',
    noMessage: true
  })
}